package com.bjpowernode.springboot.service.impl;
import com.bjpowernode.springboot.domain.User;
import com.bjpowernode.springboot.mapper.UserMapper;
import com.bjpowernode.springboot.service.TestService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TestServiceImpl implements TestService {
    @Autowired
    UserMapper userMapper;
    @Override
    public List<User> personService(int page, int size) {
        PageHelper.startPage(page, size);
        //使用分页插件，最核心的一句，即开启分页
        List<User> list = userMapper.selectDao();
        return list;
    }

    @Override
    public List<User> personServiceExcel() {
        List<User> userList = userMapper.selectDao();
        return userList;
    }


    @Override
    public int deleteByPrimaryKey(Integer id) {
        return userMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int insert(User record) {
        return userMapper.insert(record);
    }

    @Override
    public int insertSelective(User record) {
        return userMapper.insertSelective(record);
    }

    @Override
    public User selectByPrimaryKey(Integer id) {
        return userMapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateByPrimaryKeySelective(User record) {
        return userMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKey(User record) {
        return userMapper.updateByPrimaryKey(record);
    }
}
